﻿using Backend.Data.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Backend.Data.Mappings
{
    class NaturalPersonMap : EntityTypeConfiguration<NaturalPerson>
    {
        public NaturalPersonMap()
        {
            //table
            ToTable("NaturalPersons");

            //pk
            HasKey(t => t.Id);

            //property
            Property(t => t.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            Property(t => t.FirstName)
                .IsRequired();
            Property(t => t.LastName)
                .IsOptional();

        }
    }
}
